export default {
    //用于记录内部变量
    prop: {

    },

    startup(param) {
        const self = this;
        require([
            "esri/widgets/DirectLineMeasurement3D/ShowLaserHeightViewModel"
        ], function (ShowLaserHeightViewModel) {
            self.prop._showLaserHeightViewModel = new ShowLaserHeightViewModel({
                view: param.view
            });
     
            self.start = self.start.bind(self);
            self.stop = self.stop.bind(self);
            self.bindEventHandle = self.bindEventHandle.bind(self);

            self.bindEventHandle();
        });
    },

    bindEventHandle(){
        const self = this;

        document.getElementById("laserHeightBtn").addEventListener("change", event => {
            if (event.currentTarget.checked) {
                self.start();
            } else {
                self.stop();
            }
        });
    },

    start() {
        this.prop._showLaserHeightViewModel.newMeasurement();
    },

    stop() {
        this.prop._showLaserHeightViewModel.clearMeasurement();
    }
};